package com.zx.znav.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zx.znav.bean.Link;
import com.zx.znav.bean.LinkTag;
import com.zx.znav.service.LinkTagService;
import com.zx.znav.mapper.LinkTagMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author lenovo
* @description 针对表【t_link_tag】的数据库操作Service实现
* @createDate 2023-07-21 13:15:19
*/
@Service
public class LinkTagServiceImpl extends ServiceImpl<LinkTagMapper, LinkTag>
    implements LinkTagService{

    @Override
    public List<LinkTag> listByLinkId(Integer linkId) {
        LambdaQueryWrapper<LinkTag> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(LinkTag::getLinkId, linkId);
        return list(wrapper);
    }

    @Override
    public List<LinkTag> listByTagId(Integer tagId) {
        LambdaQueryWrapper<LinkTag> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(LinkTag::getTagId, tagId);
        return list(wrapper);
    }

    @Override
    public void deleteAllByLinkId(Integer linkId) {
        LambdaQueryWrapper<LinkTag> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(LinkTag::getLinkId, linkId);
        remove(wrapper);
    }
}




